All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sun.servlet.http.HttpRequest

java.lang.Object
   |
   +----sun.servlet.http.HttpRequest

public class HttpRequest
extends Object
implements HttpServletRequest
This class represents an HTTP servlet request.


Variable Index

 o authType
The authentication type for the request.
 o con
The servlet connection for the request.
 o headers
The MIME header fields for the request.
 o in
The input stream for reading request data.
 o keepAlive
Set to true if the connection should be kept alive.
 o length
The content length for this request.
 o line
The request line.
 o params
The dictionary that represents the name/values pairs for parameters passed in the request.
 o pathInfo
The path info for the request.
 o remoteUser
The remote user for the request.
 o servletPath
The servlet path for the request.

Constructor Index

 o HttpRequest()
Creates a new HttpRequest object.

Method Index

 o addAttributeDictionary(Dictionary)
Stores an attribute dictionary, to be consulted for request attributes.
 o dump(PrintStream)
Print debug information.
 o finish()
Finishes the current request.
 o getAttribute(String)
Returns an attribute of the request for the specified key name.
 o getAuthType()
Returns the authentication scheme of the request, or null if none.
 o getContentLength()
Returns the size of the request entity data, or -1 if not known.
 o getContentType()
Returns the Internet Media Type of the request entity data, or null if not known.
 o getDateHeader(String)
Returns the value of a date header field, or -1 if not found.
 o getHeader(String)
Returns the value of a header field, or null if not known.
 o getHeaderNames()
Returns an enumeration of strings representing the header names for this request.
 o getHeaders()
Returns the message header for this response.
 o getInputStream()
Returns an input stream for reading request data.
 o getIntHeader(String)
Returns the value of an integer header field, or -1 if not found.
 o getKeepAlive()
Returns true if this connection should be kept alive.
 o getMethod()
Returns the method with which the request was made.
 o getParameter(String)
Returns the value of the specified parameter for the request.
 o getParameterNames()
Returns an enumeration of strings representing the parameter names for this request.
 o getParameterValues(String)
Returns the value of the specified parameter for the request.
 o getPathInfo()
Returns optional extra path information following the servlet path, but immediately preceding the query string.
 o getPathTranslated()
Returns extra path information translated to a real file system path.
 o getProtocol()
Returns the protocol and version of the request as a string of the form <protocol>/<major version>.<minor version>.
 o getQueryString()
Returns the query string part of the servlet URI, or null if none.
 o getRealPath(String)
Applies alias rules to the specified virtual path and returns the corresponding real path.
 o getRemoteAddr()
Returns the IP address of the agent that sent the request.
 o getRemoteHost()
Returns the fully qualified host name of the agent that sent the request.
 o getRemoteUser()
Returns the name of the user making this request, or null if not known.
 o getRequestLine()
Returns the request line bytes.
 o getRequestPath()
Returns the request path bytes.
 o getRequestURI()
Returns the request URI as string.
 o getScheme()
Returns the scheme of the URL used to make this request, such as "http" or "https".
 o getServerName()
Returns the host name of the server that received the request.
 o getServerPort()
Returns the port number on which this request was received.
 o getServletPath()
Returns the part of the request URI that refers to the servlet being invoked.
 o getTotalBytes()
Returns the total number of bytes for this request.
 o init(ServletConnection)
Initializes the request using the specified servlet connection.
 o isFullRequest()
Returns true if this is a full (i.e.
 o isProxyRequest()
Returns true if this is a proxy request.
 o next()
Reads the next request from the current connection.
 o reset()
Resets the servlet request.
 o setAuthType(byte[], int, int)
Sets the authentication scheme of the request to the specified bytes.
 o setAuthType(String)
Sets the authentication scheme of the request to the specified String.
 o setHeader(String, String)
Sets the value of a header field to the specified String.
 o setKeepAlive(boolean)
Used to indicate whether this connection should be kept alive.
 o setPathInfo(byte[], int, int)
Sets the path info for the request to the specified bytes.
 o setPathInfo(String)
Sets the path info for the request to the specified string.
 o setRemoteUser(byte[], int, int)
Sets the name of the user making this request to the specified bytes.
 o setRemoteUser(String)
Sets the name of the user making this request to the specified String.
 o setRequest(HttpRequest)
 o setServletPath(byte[], int, int)
Sets the servlet path for the request to the specified bytes.
 o setServletPath(String)
Sets the servlet path for the request to the specified string.

Variables

 o line
 protected HttpRequestLine line
The request line.

 o servletPath
 protected final MessageString servletPath
The servlet path for the request.

 o pathInfo
 protected final MessageString pathInfo
The path info for the request.

 o remoteUser
 protected final MessageString remoteUser
The remote user for the request.

 o authType
 protected final MessageString authType
The authentication type for the request.

 o headers
 protected MimeHeaders headers
The MIME header fields for the request.

 o in
 protected HttpInputStream in
The input stream for reading request data.

 o con
 protected ServletConnection con
The servlet connection for the request.

 o length
 protected int length
The content length for this request.

 o keepAlive
 protected boolean keepAlive
Set to true if the connection should be kept alive.

 o params
 protected Dictionary params
The dictionary that represents the name/values pairs for parameters passed in the request.

Constructors

 o HttpRequest
 public HttpRequest()
Creates a new HttpRequest object.

Methods

 o init
 public void init(ServletConnection con) throws IOException
Initializes the request using the specified servlet connection.

Parameters:
connect - the servlet connection
Throws: IOException
if an I/O error has occurred
 o next
 public boolean next() throws IOException, InvalidRequestException
Reads the next request from the current connection. Returns true if the request could be read otherwise returns false if the end of the stream is reached.

Throws: IOException
if an I/O error has occurred
Throws: InvalidRequestException
if the request is invalid
 o finish
 public void finish() throws IOException
Finishes the current request.

 o reset
 public void reset() throws IOException
Resets the servlet request.

 o isFullRequest
 public boolean isFullRequest()
Returns true if this is a full (i.e. not HTTP/0.9) request.

 o isProxyRequest
 public boolean isProxyRequest()
Returns true if this is a proxy request.

 o getTotalBytes
 public int getTotalBytes()
Returns the total number of bytes for this request.

 o getHeaders
 public MimeHeaders getHeaders()
Returns the message header for this response.

 o setKeepAlive
 public void setKeepAlive(boolean enable)
Used to indicate whether this connection should be kept alive.

Parameters:
enable - if true then keep connection alive
 o getKeepAlive
 public boolean getKeepAlive()
Returns true if this connection should be kept alive.

 o getRequestPath
 public MessageBytes getRequestPath()
Returns the request path bytes.

 o getRequestLine
 public MessageBytes getRequestLine()
Returns the request line bytes.

 o setServletPath
 public void setServletPath(String s)
Sets the servlet path for the request to the specified string.

 o setServletPath
 public void setServletPath(byte b[],
                            int off,
                            int len)
Sets the servlet path for the request to the specified bytes.

 o setPathInfo
 public void setPathInfo(String s)
Sets the path info for the request to the specified string.

 o setPathInfo
 public void setPathInfo(byte b[],
                         int off,
                         int len)
Sets the path info for the request to the specified bytes.

 o getContentLength
 public int getContentLength()
Returns the size of the request entity data, or -1 if not known. Same as the CGI variable CONTENT_LENGTH.

 o getContentType
 public String getContentType()
Returns the Internet Media Type of the request entity data, or null if not known. Same as the CGI variable CONTENT_TYPE.

 o getProtocol
 public String getProtocol()
Returns the protocol and version of the request as a string of the form <protocol>/<major version>.<minor version>. Same as the CGI variable SERVER_PROTOCOL.

 o getScheme
 public String getScheme()
Returns the scheme of the URL used to make this request, such as "http" or "https".

 o getServerName
 public String getServerName()
Returns the host name of the server that received the request. Same as the CGI variable SERVER_NAME.

 o getServerPort
 public int getServerPort()
Returns the port number on which this request was received. Same as the CGI variable SERVER_PORT.

 o getRemoteAddr
 public String getRemoteAddr()
Returns the IP address of the agent that sent the request. Same as the CGI variable REMOTE_ADDR.

 o getRemoteHost
 public String getRemoteHost()
Returns the fully qualified host name of the agent that sent the request. Same as the CGI variable REMOTE_HOST.

 o getInputStream
 public ServletInputStream getInputStream() throws IOException
Returns an input stream for reading request data.

 o getParameter
 public String getParameter(String name)
Returns the value of the specified parameter for the request. For example, in an HTTP servlet this would return the value of the specified query string parameter. This must be used when the application is sure that there is only one value for the parameter. For multiple valued parameters, use getParameterValues.

Parameters:
name - the parameter name
Returns:
the value for the parameter. For multiple values, a comma separated string of values is returned. Preferred way is to call getParameterValues for multiple valued parameters.
See Also:
getParameterValues
 o getParameterValues
 public String[] getParameterValues(String name)
Returns the value of the specified parameter for the request. For example, in an HTTP servlet this would return the value of the specified query string parameter.

Parameters:
name - the parameter name
Returns:
an array of values for the passed parameter name. If there are no values then return null.
 o getParameterNames
 public Enumeration getParameterNames()
Returns an enumeration of strings representing the parameter names for this request.

 o getMethod
 public String getMethod()
Returns the method with which the request was made. The returned value can be "GET", "HEAD", "POST", or an extension method. Same as the CGI variable REQUEST_METHOD.

 o getRequestURI
 public String getRequestURI()
Returns the request URI as string.

 o getServletPath
 public String getServletPath()
Returns the part of the request URI that refers to the servlet being invoked. Analogous to the CGI variable SCRIPT_NAME.

 o getPathInfo
 public String getPathInfo()
Returns optional extra path information following the servlet path, but immediately preceding the query string. Returns null if not specified. Same as the CGI variable PATH_INFO.

 o getPathTranslated
 public String getPathTranslated()
Returns extra path information translated to a real file system path. Returns null if no extra path information was specified or translated path was unavailable. Same as the CGI variable PATH_TRANSLATED.

 o getRealPath
 public String getRealPath(String path)
Applies alias rules to the specified virtual path and returns the corresponding real path.

 o getQueryString
 public String getQueryString()
Returns the query string part of the servlet URI, or null if none. Same as the CGI variable QUERY_STRING.

 o setRemoteUser
 public void setRemoteUser(String s)
Sets the name of the user making this request to the specified String.

Parameters:
s - the user name
 o setRemoteUser
 public void setRemoteUser(byte b[],
                           int off,
                           int len)
Sets the name of the user making this request to the specified bytes.

Parameters:
b - the user name bytes
off - the start offset of the bytes
len - the length of the bytes
 o getRemoteUser
 public String getRemoteUser()
Returns the name of the user making this request, or null if not known. Same as the CGI variable REMOTE_USER.

 o setAuthType
 public void setAuthType(String s)
Sets the authentication scheme of the request to the specified String.

Parameters:
s - the authentication scheme
 o setAuthType
 public void setAuthType(byte b[],
                         int off,
                         int len)
Sets the authentication scheme of the request to the specified bytes.

Parameters:
b - the authentication scheme bytes
off - the start offset of the bytes
len - the length of the bytes
 o getAuthType
 public String getAuthType()
Returns the authentication scheme of the request, or null if none. Same as the CGI variable AUTH_TYPE.

 o getHeader
 public String getHeader(String name)
Returns the value of a header field, or null if not known. The case of the header field name is ignored.

Parameters:
name - the case-insensitive header field name
 o setHeader
 public void setHeader(String name,
                       String value)
Sets the value of a header field to the specified String.

Parameters:
name - the header field name
value - the header field String value
 o getIntHeader
 public int getIntHeader(String name)
Returns the value of an integer header field, or -1 if not found. The case of the header field name is ignored.

Parameters:
name - the case-insensitive header field name
 o getDateHeader
 public long getDateHeader(String name)
Returns the value of a date header field, or -1 if not found. The case of the header field name is ignored.

Parameters:
name - the case-insensitive header field name
 o getHeaderNames
 public Enumeration getHeaderNames()
Returns an enumeration of strings representing the header names for this request. Some server implementations do not allow headers to be accessed in this way, in which case this method will return null.

 o getAttribute
 public Object getAttribute(String name)
Returns an attribute of the request for the specified key name.

Parameters:
name - the attribute name
Returns:
the attribute value or null if not found
 o addAttributeDictionary
 public void addAttributeDictionary(Dictionary d)
Stores an attribute dictionary, to be consulted for request attributes.

 o dump
 public void dump(PrintStream out)
Print debug information.

 o setRequest
 protected void setRequest(HttpRequest req)

All Packages  Class Hierarchy  This Package  Previous  Next  Index